<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue.js</title>
    <link rel="stylesheet" href="style.css">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="vue-app">
        <h1>动态 CSS Class</h1>

        <h2>示例 1</h2>
        <div :class="{changeColor:changeColor}" @click="changeColor = !changeColor">
            <span>ABC</span>
        </div>

        <h2>示例 2</h2>
        <div :class="{changeLength:changeLength}" @click="changeLength = !changeLength">
            <span>ABC</span>
        </div>

        <h2>示例 3</h2>
        <div :class="{changeColor:changeColor, changeLength:changeLength}">
            <span>ABC</span>
        </div>

        <!-- 计算属性 -->
        <h2>示例 3</h2>
        <div :class="compClasses">
            <span>ABC</span>
        </div>
    </div>
    <script src="app.js"></script>
</body>
</html>